﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Library.Navigation;
using LibraryTest.Models.Navigation;

namespace LibraryTest.Views.NavigationProviderTest
{
    public partial class Page2 : PhoneApplicationPage
    {
        public Page2()
        {
            InitializeComponent();
            NavigationProvider.Instance.Navigated += new NavigationProviderEventHandler(OnPageNavigated);
        }

        private void OnPageNavigated(object sender, NavigationProviderEventArgs e)
        {
            NavigationProvider.Instance.Navigated -= new NavigationProviderEventHandler(OnPageNavigated);
            var parameter = (Page2Parameter)e.ToEntry.Parameter;
            this.idTextblock.Text = parameter.Id.ToString();
            this.titleTextblock.Text = parameter.Title;
        }
    }
}